}
}
-static int
-gtk_column_view_allocate_columns (GtkColumnView *self,
- int width)
+void
+gtk_column_view_distribute_width (GtkColumnView *self,
+ int width,
+ GtkRequestedSize *sizes)
{
GtkScrollablePolicy scroll_policy;
- int col_min, col_nat, extra, col_size, x;
+ int col_min, col_nat, extra, col_size;
int n, n_expand, expand_size, n_extra;
guint i;
- GtkRequestedSize *sizes;
n = g_list_model_get_n_items (G_LIST_MODEL (self->columns));
n_expand = 0;
- sizes = g_newa (GtkRequestedSize, n);
+
for (i = 0; i < n; i++)
{
GtkColumnViewColumn *column;
else
expand_size = n_extra = 0;
- x = 0;
for (i = 0; i < n; i++)
{
GtkColumnViewColumn *column;
n_extra--;
}
}
+ sizes[i].minimum_size = col_size;
+ }
+
+ g_object_unref (column);
+ }
+}
+
+static int
+gtk_column_view_allocate_columns (GtkColumnView *self,
+ int width)
+{
+ guint i, n;
+ int x;
+ GtkRequestedSize *sizes;
+
+ n = g_list_model_get_n_items (G_LIST_MODEL (self->columns));
+
+ sizes = g_newa (GtkRequestedSize, n);
+
+ gtk_column_view_distribute_width (self, width, sizes);
+
+ x = 0;
+ for (i = 0; i < n; i++)
+ {
+ GtkColumnViewColumn *column;
+ int col_size;
+
+ column = g_list_model_get_item (G_LIST_MODEL (self->columns), i);
+ if (gtk_column_view_column_get_visible (column))
+ {
+ col_size = sizes[i].minimum_size;
gtk_column_view_column_allocate (column, x, col_size);
if (self->in_column_reorder && i == self->drag_pos)
#include "gtk/gtkcolumnview.h"
#include "gtk/gtklistview.h"
+#include "gtk/gtksizerequest.h"
#include "gtk/gtkcolumnviewsorterprivate.h"
#include "gtk/gtklistitemwidgetprivate.h"
int *minimum,
int *natural);
+void gtk_column_view_distribute_width (GtkColumnView *self,
+ int width,
+ GtkRequestedSize *sizes);
+
#endif /* __GTK_COLUMN_VIEW_PRIVATE_H__ */